define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {

    var Controller = {
        index: function () {
            Controller.api.bindevent();
        },
        add: function () {
            Controller.api.bindevent();
        },
        edit: function () {
            Controller.api.bindevent();
        },
        api: {
            bindevent: function () {
                //主题色设置
                $(".list").click(function (e) {
                    $(".list").removeClass('active');
                    $(this).addClass('active');
                    $("#color").val($(this).find('.txt').attr('id'));
                    $("#value").val($(this).find('.txt').data('value'));
                });

                $(document).on("change", "#c-gift_status", function(){
                    //开关切换后的回调事件
                    if ($(this).val()==1){
                        $('#c-ios_gift_status,#c-gift_person').val($(this).val()).next('a').children('i').removeClass('fa-flip-horizontal text-gray')
                    }else {
                        $('#c-ios_gift_status,#c-gift_person').val($(this).val()).next('a').children('i').addClass('fa-flip-horizontal text-gray')
                    }
                });

                Form.api.bindevent($("form[role=form]"));

            }
        }
    };
    return Controller;
});
